local artofWarSkill = fk.CreateSkill{
  name = "#zyg__artofWarSkill"
}
local artofWarActiveSkill = {
  prompt = "#artofWarSkill",
  card_filter = function(self, to_select, selected)
    return #selected == 0
  end,
  view_as = function(self, cards)
    if #cards ~= 1 then return end
    local card = Fk:cloneCard("slash")
    card.skillName = self.name
    card:addSubcard(cards[1])
    return card
  end,
}
local artofWarSkill_ = {
  mute = true,
  refresh_events = {fk.TurnEnd},
  can_refresh = function(self, event, target, player, data)
    if player == target then
      return table.find(player.room.alive_players, function(p)
        return p:getMark("@@artofWar_slash-turn") ~= 0
      end)
    end
  end,
  on_refresh = function(self, event, target, player, data)
    local room = player.room
    local targets = table.map(room.alive_players, Util.IdMapper)
    room:sortPlayersByAction(targets)
    for _, i in ipairs(targets) do 
      local p = room:getPlayerById(i)
      if not p.dead and not p:isNude() and not p:prohibitUse(Fk:cloneCard("slash")) and p:getMark("@@artofWar_slash-turn") ~= 0 then
        local _, dat = room:askForUseActiveSkill(p, "#zyg__artofWarActiveSkill", nil, true)
        if dat then
          local card = Fk:cloneCard("slash")
          card:addSubcards(dat.cards)
          room:useCard({
            from = p.id,
            tos = table.map(dat.targets, function(id) return {id} end),
            card = card,
          })
        end
      end
    end
  end,
}
artofWarSkill:addEffect("active", artofWarActiveSkill)
artofWarSkill:addEffect(fk.TurnEnd, artofWarSkill_)
return artofWarSkill